package demo.thread;

/**
 * @author small瑞
 */
public class MyThread extends Thread{
    private String message;

    public MyThread() {
    }

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        super.run();
        for(int i = 0 ; i < 10 ; i++){
            System.out.println(this.getName()+":"+i);
            if(i==2){
                Thread.yield();
            }
            if(i==3){
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }


    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
